package com.ltmall.api.enums;

/**
 * 小区团购状态枚举
 *
 * @author dou.guo
 * @Title DirectSupplyStatusEnum.java
 * @Description 类DirectSupplyStatusEnum.java的实现描述：类实现描述 
 * @date 2018年9月30日 上午10:49:55
 * @package com.wuwangkeji.homeflavor.enums
 */
public enum DirectSupplyStatusEnum {

    /**初始化*/
    INIT(0, "初始化"),

    /**审核通过*/
    PASS(1, "审核通过"),

    /**审核拒绝*/
    REJECT(2, "审核拒绝"),

    ;

    private int    code;
    private String name;

    private DirectSupplyStatusEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static DirectSupplyStatusEnum getEnumByCode(int code) {
        DirectSupplyStatusEnum[] arr = DirectSupplyStatusEnum.values();
        for (DirectSupplyStatusEnum e : arr) {
            if (e.code == (code)) {
                return e;
            }
        }
        return null;

    }

    public static DirectSupplyStatusEnum getEnumByName(String name) {
        if (name == null) {
            return null;
        }
        DirectSupplyStatusEnum[] arr = DirectSupplyStatusEnum.values();
        for (DirectSupplyStatusEnum e : arr) {
            if (e.name.equals(name)) {
                return e;
            }
        }
        return null;

    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

}
